package com.jadows.tdog.controller;

import com.jadows.tdog.base.PageRecords;
import com.jadows.tdog.base.R;
import com.jadows.tdog.domain.ChatMessage;
import com.jadows.tdog.po.ChatMessagePagePo;
import com.jadows.tdog.service.ChatMessageService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RequestMapping("/message")
@RequiredArgsConstructor
@RestController
public class ChatMessageController {

    final ChatMessageService chatMessageService;

    @GetMapping("/page")
    public R<?> pageChatMessage(@Validated ChatMessagePagePo chatMessagePagePo) {
        PageRecords<ChatMessage> messages = chatMessageService.pageChatMessage(chatMessagePagePo);
        return R.ok(messages);
    }

}